<?php
$goods_id = isset($_POST['goods_id']) ? intval($_POST['goods_id']) : 0;
if (empty($goods_id)) {
    echo json_encode(['status' => 400, 'message' => '商品不存在']);exit;
}
session_start();
$goodsCart = $_SESSION['carts'];
unset($goodsCart[$goods_id]);
$_SESSION['carts'] = $goodsCart;

echo json_encode(['status' => 200, 'message' => '删除成功']);exit;